On 6 January 2011 16:01, Gwern Branwen <[email protected]> wrote:

> On Thu, Jan 6, 2011 at 12:43 AM, dazedconfused <[email protected]>
> wrote:
> > I had the same idea  while back, but I don't have the technical
> > expertise to realize it. Are you working on this?
>
>

No, not really. It's contingent on 2.0 finally coming out, and I don't
> know Python either. I was planning on, whenever I felt the practical
> need for dynamic cards, either asking someone to write a dynamic card
> type which just shelled out to a system-wide executable (which I could
> write in Haskell, which I do know pretty well) or blundering my way
> through until I had such a dynamic card.
>
>
Very nice article. What do you mean by a system-wide executable here,
though? Could we just check for an attribute "lang" or something, and take
that to be the interpreter that will execute the (escaped) code in the src
parameter?

e.g.
<eval src="a = rand(99)+1; b = rand(99)+1; puts \"#{a} * #{b} = #{a*b}\""
lang="ruby"/>

Mnemosyne could just dump the src value to a temporary file and call the
specified interpreter (in this case "ruby tmp"), capturing the standard as
the result of the <eval>?

While I love the idea, I'm finding it hard to come up with simple-to-write
dynamic cards that would really be useful, outside of perhaps some
mathematical things like this or long division.

Oisín


p.s. I tried to write that example in Lua just now and discovered that you
need to give a random seed to get different outputs on each run, AND Lua
doesn't offer any time function which gives better than second resolution
(i.e. less useful for random seeds) AND the random number generator on BSD
or at least my Mac is shockingly bad, giving almost identical results for
two random seeds which are close together in value. Boo hiss.

--
> gwern
> http://www.gwern.net
>

-- 
You received this message because you are subscribed to the Google Groups 
"mnemosyne-proj-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/mnemosyne-proj-users?hl=en.

Reply via email to