|
Presa Canario posted:I'm trying to write an AI game search tree with a depth-first search in java. I already have a recursive version that works, but this seems like it would be a lot faster. The problem is it needs to iterate somehow so that I can stop it at a maximum depth, and so that I can do min/max at certain levels. I tried doing this: You seem to be increasing the 'depth' value based on the number of children the node at depth = 0 has, which I don't think is what you want to do. The difference between the depth of the current value, and the next value on the top of the stack is what is going to change the depth. It would probably be better to store the depth of nodes, along with the nodes themselves, so you don't have to handle any incrementing. If you had a tree like this: And your last node by depth would be node 7, your code will only increment the depth by 1, rather than returning to depth 1 (where nodes 2/3 are). defmacro fucked around with this message at 18:41 on Mar 28, 2008 |
# ¿ Mar 28, 2008 18:20 |
|
|
# ¿ Apr 29, 2024 11:48 |
|
happylf posted:How different are Scheme and Common LISP? Similar like C++ and Java? The two big differences are namespaces and libraries. You'll see Scheme and Common Lisp referred to as Lisp-1 and Lisp-2 respectively. Lisp-1's have everything in one namespace (functions, variables, etc.) while a Lisp-2 has separate namespaces for the previously mentioned things. Because of this, Common Lisp code can get a little messy when you're dealing with function application. This paper explains the differences much more extensively. Scheme is generally used as a teaching language because the language itself is very small. Common Lisp has a much more robust built-in library (this might be a good comparison between Java and C++ without the STL). I'd argue if you wanted to develop a 'serious' application, you'd want to use Common Lisp, but if you just want some experience with functional programming, Scheme would be a better choice. There are some other minor differences between the two (syntax, Scheme can generally compile to C or binaries more easily than Common Lisp, etc.), but these are the biggest.
|
# ¿ Jun 15, 2008 06:59 |
|
Neslepaks posted:I have no idea what this means, but I don't think the comparison is similar on anything but a very superficial level (small/non-oo vs big/oo). That's probably the only level that would really matter to a beginner.
|
# ¿ Jun 15, 2008 22:19 |
|
Neslepaks posted:But the discussion was whether or not learning Scheme and CL at the same time would be confusing. And I stand by my claim that it wouldn't, at least not in any degree approaching what it would be to learn C and C++ at the same time. Well, agreed in that case.
|
# ¿ Jun 15, 2008 22:31 |
|
Plastic Jesus posted:alias wireshark='open -a /Applications/Wireshark.app' Except for, you know, using terminal applications.
|
# ¿ Jul 10, 2008 03:33 |
|
VVV good point, moved my questions to the RoR thread.
defmacro fucked around with this message at 01:03 on Jul 25, 2008 |
# ¿ Jul 24, 2008 10:29 |
|
rjmccall posted:
For example: code:
code:
|
# ¿ Sep 16, 2008 02:06 |
|
Vanadium posted:Can you implement cond with a macro, without using if or whatever? Here's IF without COND code:
There's IF. COND is based (generally) an IF, you could see some sample source here. Here's it defined with my IF: code:
ps: lisp rules defmacro fucked around with this message at 23:00 on Sep 16, 2008 |
# ¿ Sep 16, 2008 17:53 |
|
Vanadium posted:Now if only someone would take all the cool features and put them into a useful language. that's cool, not enough parentheses though defmacro fucked around with this message at 18:37 on Sep 16, 2008 |
# ¿ Sep 16, 2008 18:34 |
|
Clock Explosion posted:So, does anyone know of any resources about programming a shell, as in writing a CLI, as opposed to shell programming? You might want to check out the CS:APP shell lab for this. It's what we used in my systems class and was a pretty fun lab.
|
# ¿ Feb 6, 2009 02:57 |
|
Triple Tech posted:Modern RDBMSes are based on arrays, right? So the data is stacked together, side by side as columns, and then rows, and it makes access really fast... The closest thing to what you're asking that I'm aware of is indexing XML documents into relational databases, mainly done for scaling up the search of XML documents. Naturally, this is much faster and uses less memory than building up a tree and searching that. It isn't a terribly elegant approach, but considering the years of work done in databases, leveraging a seasoned field to improve search is a pretty killer idea.
|
# ¿ Jun 3, 2009 03:30 |
|
rugbert posted:does anyone remember that desktop interface we all made a few years back? It was called tsDesk or something? It was originally made by 69apples or someone.. this? googling "tsdesk" seemed to help
|
# ¿ Jun 18, 2009 06:18 |
|
Plorkyeran posted:What exactly do you gain from validation that says that asdjfhklsdjfh@sdjhfiuyiulkjdhf.com is a valid email address? The truth is more important than the email account itself. Duh.
|
# ¿ Sep 24, 2009 03:58 |
|
NO! I DONT DO ANAL! posted:Hmm, could be stack overflow... Here, have a gigantically trimmed-down version of the output for (! 1362) Is there any reason you're using ACL2 in lieu of a nicer Lisp implementation (mzscheme, SBCL, Clojure, CLisp, etc.) for general programming? ACL2 is for computer-aided proofs, not general purpose programming. Here's the error generated by SBCL: code:
code:
defmacro fucked around with this message at 03:40 on Mar 25, 2010 |
# ¿ Mar 25, 2010 03:37 |
|
Scaramouche posted:Has anyone done any work around pluralization and synonyms as it relates to search keywords? I'm wondering if there are any readily available synonym dictionaries or thesauri out there that can be used for matching, that would handle plurals properly such Dress versus Dresses or Pants versus Pantses. We can make up some rules as well (such as if *s,*ses then -s and so on) but it obviously won't catch all cases. Maybe even a list of exceptions if anyone's come across one. Here are some resources: nifty web-based pluralizer paper on the issue rules for irregular plurals
|
# ¿ Jun 28, 2010 16:51 |
|
Scaramouche posted:Thanks for the references. I've passed them on to the programmer working on it, hopefully they'll help him. I was more looking for shortcuts since sometimes these guys see the 'hard' solution as elegant and I'm more of a 'get-r-done' kind of guy. There are pre-fab'd stemmers (like Porter) that have rules to turn plural words into word stems. You may be able to use one of these to check against the special cases to ensure your code is working properly. Aside from googling around for code fragments, this your best "get-r-done" bet. It's certainly gross though and in all honesty, probably won't work too well.
|
# ¿ Jun 28, 2010 23:16 |
|
nielsm posted:In bash, you can add 2>&1 in before the |tee part, to redirect standard error to standard out. Most shells support &| as a shortcut for 2>&1 |.
|
# ¿ Mar 24, 2011 05:50 |
|
TasteMyHouse posted:homebrew owns. It's the kind of thing that makes me want to learn Ruby better... but I feel like I'm betraying Python The amount of Ruby you need to understand to write a formula is tiny. Just read a few formulas and you should be good to go.
|
# ¿ Oct 12, 2011 19:55 |
|
Shaocaholica posted:Does anyone know how I can something similar to this but instead of a single sequential process, spawn multiple processes/threads? If you'd rather stick to the shell, give parallel a try. defmacro fucked around with this message at 22:23 on Oct 25, 2011 |
# ¿ Oct 25, 2011 06:13 |
|
AlsoD posted:I'm just starting to use LaTeX and while finding out how to do a particular thing doesn't seem that hard, knowing what to do is a lot less certain. listings sucks, I'd recommend you use minted/pygments if you can get it to work. The results are head and shoulders above what listings can do. This will require some more upfront time getting used to the library, but it's well worth it. Also, make sure you're using an editor with some kind of snippet functionality (vim/emacs/TextMate/whatever). This allows you to type sec<TAB> and it autofills the markup for a section declaration and let's you tab through the fields. An absolute must if you become a heavy LaTeXer. And if you get stuck, you'll probably get better answers in the LaTeX Megathread. edit: This is a good general LaTeX guide. I'd read at least the first two sections, add in the third if you'll be doing lots of math. I still pull this up every so often as a reference. edit2: VVV that rules defmacro fucked around with this message at 05:04 on Oct 26, 2011 |
# ¿ Oct 25, 2011 22:29 |
|
GregNorc posted:R stuff Some general R tips:
|
# ¿ Nov 26, 2011 05:32 |
|
GregNorc posted:So I''m trying to use subset() in R to remove inelligible participants from some study data. subset() returns all columns by default, you don't need to specify it with select: code:
EDIT: Not sure how I missed the earlier post. defmacro fucked around with this message at 20:27 on Dec 1, 2011 |
# ¿ Dec 1, 2011 20:23 |
|
Gin_Rummy posted:Highly probable, though I can't say for sure. The training set was massive... thousands and thousands of emails. That looks like the issue to me. You're making a separate CountVectorizer for the second dataset, so it's vectorizing things differently. Use code:
|
# ¿ Nov 3, 2021 02:50 |
|
Gin_Rummy posted:Is "transform" the proper library call? Different variations of message_bow.transform, fit, and fit_transform have given me a new type of value error. If I am no longer using "CountVectorizer" would I still be able to call my analyzer, which was meant to parse my input text? Ah sorry, I remembered the syntax incorrectly. You'll want to do something like this: code:
The three methods of a vectorizer do the following things: * fit fits the words to the vectorizer and updates it's internal state * transform, given an existing fitted vectorizer, returns the transformed vectors * fit_transform does both A contrived example: code:
defmacro fucked around with this message at 14:42 on Nov 4, 2021 |
# ¿ Nov 4, 2021 14:40 |
|
|
# ¿ Apr 29, 2024 11:48 |
|
Gin_Rummy posted:Just reporting back to thank you all for the ML guidance. I was able to sort through most of the problems and get it working! Now I have to ask if anyone can recommend a good way to "call" my trained model in another script/instance? An error would help! I googled and found this saying you might just need to import it, but it's from a decade ago so who knows.
|
# ¿ Nov 8, 2021 16:28 |